package com.his.controller;

import com.his.bean.DzmPatient;
import com.his.service.DzmPatientService;
import com.his.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class DzmPatientController {
    @Autowired
    DzmPatientService DPS;
//    患者库查询
    @RequestMapping("queryDzmPatient")
    public Object queryDzmPatient(DzmPatient dzmPatient){
        return new ResponseResult(200,"患者库查询成功",DPS.queryDzmPatient(dzmPatient));
    }

    //    患者库添加
    @RequestMapping("addDzmPatient")
    public Object addDzmPatient(DzmPatient dzmPatient){
        System.out.println(dzmPatient+"zhe是患者数据");
        return new ResponseResult(200,"患者库添加成功",DPS.addDzmPatient(dzmPatient));
    }

    //    患者库修改
    @RequestMapping("updateDzmPatient")
    public Object updateDzmPatient(DzmPatient dzmPatient){
        System.out.println(DPS.updateDzmPatient(dzmPatient));
        return new ResponseResult(200,"患者库添加成功",DPS.updateDzmPatient(dzmPatient));
    }

    //    患者库删除
    @RequestMapping("deleteDzmPatient")
    public Object deleteDzmPatient(Integer patientId){
        System.out.println(patientId+"患者id");
        return new ResponseResult(200,"患者库删除成功",DPS.deleteDzmPatient(patientId));
    }

    //    患者库id查询
    @RequestMapping("queryById")
    public Object queryById(Integer patientId){
        System.out.println(patientId);
        DzmPatient list=  DPS.queryById(patientId);
        System.out.println(list);
        return new ResponseResult(200,"患者库id查询成功",list);
    }
}
